<template>
  <view class="nowCard">
    <view class="nowCardLeft">
      <view class="nowCardTime">
        <up-badge :is-dot="true" type="error"></up-badge>
        <p :style="{ paddingLeft: '5px', textAlign: 'baseline' }">
          截至&nbsp;&nbsp;{{ formatISODate(props.project?.start_time) }}
        </p>
      </view>
      <view class="nowCardTitle">{{ props.project?.title }}</view>
    </view>
    <view class="infoIcon">
      <up-icon name="arrow-right" size="25" color="#b4b5b7" @click="handleToInfo"></up-icon>
    </view>
  </view>
</template>

<script setup>
import { useRouter } from 'uniapp-router-next'
import { defineProps } from 'vue'
import { formatISODate } from '@/utils/date'

const props = defineProps({
  project: {
    type: Object,
    required: true,
  },
})
const router = useRouter()
const handleToInfo = () => {
  router.navigateTo({
    path: '/pages/projectInfoPage/index',
    //参数
    query: {
      project_id: props.project?.project_id,
    },
  })
}
</script>

<style lang="scss" scoped>
.nowCard {
  width: 90vw;
  min-height: 90px;
  background-color: #f6f7f9;
  border-radius: 8px;
  margin: 10px;
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  align-items: center;
}

.nowCardLeft {
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}

.nowCardTime {
  display: flex;
  align-items: center;
  color: #cdced0;
  margin-bottom: 3px;
}

.nowCardTitle {
  font-size: 16px;
  flex-direction: column;
  margin-top: 3px;
  overflow: 'hidden';
  text-overflow: 'hidden';
  white-space: 'nowrap';
  letter-spacing: 1px;
}

.infoIcon {
  margin-right: 10px;
}
</style>
